package com.hujiang.basic.search.handler.impl.model;

import java.util.Date;

import lombok.Data;

@Data
public class HandlerInfo {

    public HandlerInfo() {}

    public HandlerInfo(String queue,String alias) {
        this.queue = queue;
        this.alias = alias;
        this.active = true;
        this.createTime = new Date();
        this.updateTime = new Date();
    }

    private int id;
    private String queue;
    private String alias;
    private boolean active;
    private Date createTime;
    private Date updateTime;
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        HandlerInfo other = (HandlerInfo) obj;
        if (active != other.active)
            return false;
        if (id != other.id)
            return false;
        if (queue == null) {
            if (other.queue != null)
                return false;
        } else if (!queue.equals(other.queue))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (active ? 1231 : 1237);
        result = prime * result + id;
        result = prime * result + ((queue == null) ? 0 : queue.hashCode());
        return result;
    }
}
